<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <input type="text" id="inp">
    <script>
        // e.key键盘按键的内容=>a--->a
        // e.code是英文键盘字符a--->keyA
        // e.keyCode是键盘数字a--->65
        inp.onkeydown=function(e){
            // console.log(e.keyCode);//键码号
            console.log(e.code);
        }
    </script>
</body>
</html>